import request from '@/utils/request'

const RESOURCE_URL = 'system/roles'

export function getRoleList(params) {
  return request({
    url: RESOURCE_URL,
    method: 'get',
    params
  })
}

export function createRole(data) {
  return request({
    url: RESOURCE_URL,
    method: 'post',
    data
  })
}

export function getPermissionList() {
  return request({
    url: 'system/data',
    method: 'get',
    params: {
      model: 'permission'
    }
  })
}

export function updateRole(data) {
  return request({
    url: RESOURCE_URL + '/' + data.id,
    method: 'put',
    data
  })
}

export function destroyRole(data) {
  return request({
    url: RESOURCE_URL + '/' + data.id,
    method: 'delete',
    data
  })
}
